package com.ecpss.springsecuritydemo8000.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class DemoController {
    @ResponseBody
    @RequestMapping("/add")
    public String aa() {
        return "ss";
    }
   @ResponseBody
    @GetMapping("test/index")
    public String index() {
        return "hello";
    }

    @GetMapping("findAll")
    @ResponseBody
    public String findAll() {
        return "findAll";
    }


    // 测试注解：
    @RequestMapping("/testSecured")
    @ResponseBody
    @Secured({"ROLE_normal","ROLE_admin"})
    public String helloUser() {
        return "hello,user";
    }



}
